<!DOCTYPE html>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href='__HOME__/css/aui.css' rel='stylesheet' />
<link href='__HOME__/images/login.css' rel='stylesheet' />
<title>注册</title>
<body>
   <div class='logo'>
      <img src='__HOME__/images/logo.png'>
   </div>
   <table class='login_form' align=center style='margin-top:1rem;'>
      <tr><td><img src='__HOME__/images/avatar.png' /></td><td><input type='text' placeholder='用户名' id='username' /></td></tr>
      <tr><td><img src='__HOME__/images/lock.png' /></td><td><input type='password' placeholder='密码' id='pwd' /></td></tr>
	  <tr><td><img src='__HOME__/images/avatar.png' /></td><td><input type='text' placeholder='手机号' id='mobile' /></td></tr>
      <tr><td><img src='__HOME__/images/lock.png' /></td><td><input type='password' placeholder='确认密码' id='confirm_pwd' /></td></tr>
      <!--<tr><td><img src='__HOME__/images/lock.png' /></td><td>
          <input type='text' placeholder='验证码' id='verify_code' />
          <a class='code_btn' href='javascript:get_code()'>获取验证码</a>
      </td></tr>-->
      <tr><td><img src='__HOME__/images/lock.png' /></td><td><input type='text' value="{$invint_id|strtoupper}" placeholder='邀请码(必填)' id='invent_id' /></td></tr>
   </table>
   
   <div class='opt_btn'>
      <a href='javascript:register()'>立即注册</a>
   </div>
   <div class='book'>
       <label>登录代表阅读并同意《FOS服务条款》</label>
   </div>
   {include file="common/footer"/}
   
   <script>
      var dialog = new auiDialog({})
      function register(){
        var username = $('#username').val();
        if (!username) {
			dialog.alert({
				title:"提示",
				msg:"请填写用户名!",
				buttons:['确定']
			});
            return;
        }
        var pwd   = $('#pwd').val();
        if (!pwd) {
			dialog.alert({
				title:"提示",
				msg:"请输入密码!",
				buttons:['确定']
			});
            return;
        }
		var confirm_pwd = $("#confirm_pwd").val();
		if(pwd != confirm_pwd){
			dialog.alert({
				title:"提示",
				msg:"两次密码不正确!",
				buttons:['确定']
			});
			return ;
		}
		var mobile = $("#mobile").val();
		if(!mobile){
			dialog.alert({
				title:"提示",
				msg:"请输入手机号!",
				buttons:['确定']
			});
			return ;
		}
		var invent_id   = $('#invent_id').val();
        if (!invent_id) {
			dialog.alert({
				title:"提示",
				msg:"请输入邀请码!",
				buttons:['确定']
			});
            return;
        }

        $.post('{:url("register")}', {username:username,pwd:pwd, invent_id:invent_id, mobile:mobile}, function(res){
            if (res.status == 1) {
				dialog.alert({
					title:"提示",
					msg:res.message,
					buttons:['确定']
				}, function(){
				     location.href = res.url;
				});
               
            } else {
                dialog.alert({
					title:"提示",
					msg:res.message,
					buttons:['确定']
				});
            }
        });
    }
   </script>
</body>
</html>